package com.example.camunda.dto;

import lombok.Data;
import org.camunda.bpm.engine.repository.ProcessDefinition;
import org.springframework.beans.BeanUtils;

/**
 * 流程定义DTO
 *
 * @author heshao
 * @date 2021/11/8 17:46
 **/
@Data
public class ProcessDefinitionDto {

    private String id;
    private String key;
    private String category;
    private String description;
    private String name;
    private int version;
    private String resource;
    private String deploymentId;
    private String diagram;
    private boolean suspended;
    private String tenantId;
    private String versionTag;
    private Integer historyTimeToLive;
    private boolean isStartableInTasklist;

    public static ProcessDefinitionDto from(ProcessDefinition definition) {
        ProcessDefinitionDto dto = new ProcessDefinitionDto();
        BeanUtils.copyProperties(definition, dto);
        return dto;
    }
}
